package com.dingding.order.core.publish.dao.impl;

import org.apache.log4j.Logger;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Component;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.beans.Userordert;
import com.dingding.order.core.publish.dao.IPublishOrderDao;

/**
 * @ClassName: PublishOrderDaoImpl 
 * @Description: 发布订单DAO实现类
 * @author YHQ
 * @date 2016年6月3日 上午11:33:01
 */
@Component("publishOrderDao")
public class PublishOrderDaoImpl extends BaseDaoImpl<Userordert> implements IPublishOrderDao {

	private Logger log = Logger.getLogger(this.getClass());
	
	/**
	 * @Title: getUserOrdertByUserId
	 * @Description: 通过用户Id获取订单信息
	 * @param userId 用户Id
	 * @author yuHaiQing
	 * @return Userordert    返回类型
	 */
	@Override
	public Userordert getUserOrdertByUserId(String userId) {
		
		Criterion criterion = Restrictions.eq("placeOrderUserId", userId);
		
		try {
			return super.queryCriteriaUnResult(criterion);
		} catch (Exception e) {
			log.error("根据用户Id获取", e);
		}
		
		return null;
	}

}
